<template>
	<view class="container">
		<view class="content">
			<view class="text">可以向你的好友索取邀请码，填写后，你将成为好友的团队成员</view>
		</view>
		<view class="form">
			<view class="code">
				<input placeholder="填写好友的邀请码" v-model="code"/>
			</view>
			<view class="btn" @tap="confirmEx">确认</view>
		</view>
	</view>
</template>

<script>
	import Api from '@/common/api';
	export default {
		data() {
			return {
				code:'',
			}
		},
		onShow() {
			
		},
		onLoad() {},
		methods: {
			async confirmEx(){
				uni.hideKeyboard()
				if(!this.code){
					uni.showToast({title: '填写好友的邀请码',icon:"none"});
					return false;
				}
				let params = {'invite_code': this.code}
				let data = await Api.apiCall('post',Api.agent.bind_invite, params)
				if(data){
				  uni.showToast({title: '绑定成功',icon:"none"});
				  uni.navigateBack();
				}
			}

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}
	.container {
		width: 100%;
		padding: 0 40upx;
		border-top: solid 1upx #dedede;
		
	}
	.content{
		width: 100%;
		padding: 88upx 0 100upx;
		flex-wrap: wrap;
		.text{
			width: 100%;
			height: 88upx;
			line-height: 44upx;
			padding-right: 12upx;
			// text-indent:2em;
			letter-spacing:1upx;
			color: #232323;
			font-size: $font-sm + 4upx;
		}
	}
	.form{
		width: 100%;
		height: 240upx;
		.code {
			width: 100%;
			height:88upx;
			display: flex;
			align-items: center;
			border-radius: 44upx;
			border: 1upx solid #E1E4E5;
			box-shadow: 0upx 1upx 0upx rgba($color: #E1E4E5, $alpha: 0.7);
			input {
				width: 100%;
				height: 50upx;
				padding-left: 32upx;
				// color: rgba($color: #ACADAE, $alpha: 0.1);
				color: #ACADAE;
				font-weight: 300;
			}
		}
		.btn{
			width: 100%;
			height: 98upx;
			margin-top: 50upx;
			border-radius: 45upx;
			display: flex;
			justify-content: center;
			align-items: center;
			
			background-color: #FFBC21;
		}
	}
	
</style>
